home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / actfancr.c < prev    next >
C/C++ Source or Header  |  2000-05-25  |  24KB  |  711 lines

  1. /*******************************************************************************
  2.  
  3.     Act Fancer (Japan)                FD (c) 1989 Data East Corporation
  4.     Act Fancer (World)                FE (c) 1989 Data East Corporation
  5.     Trio The Punch (Japan)            FF (c) 1989 Data East Corporation
  6.  
  7.     The 'World' set has rom code FE, the 'Japan' set has rom code FD.
  8.  
  9.     Most Data East games give the Japanese version the earlier code, though
  10.     there is no real difference between the sets.
  11.  
  12.     I believe the USA version of Act Fancer is called 'Out Fencer'
  13.  
  14.     Emulation by Bryan McPhail, mish@tendril.co.uk
  15.  
  16. *******************************************************************************/
  17.  
  18. #include "driver.h"
  19. #include "vidhrdw/generic.h"
  20. #include "cpu/m6502/m6502.h"
  21. #include "cpu/h6280/h6280.h"
  22.  
  23. void actfancr_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  24. void triothep_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  25. WRITE_HANDLER( actfancr_pf1_data_w );
  26. READ_HANDLER( actfancr_pf1_data_r );
  27. WRITE_HANDLER( actfancr_pf1_control_w );
  28. WRITE_HANDLER( actfancr_pf2_data_w );
  29. READ_HANDLER( actfancr_pf2_data_r );
  30. WRITE_HANDLER( actfancr_pf2_control_w );
  31. int actfancr_vh_start (void);
  32. int triothep_vh_start (void);
  33.  
  34. extern unsigned char *actfancr_pf1_data,*actfancr_pf2_data,*actfancr_pf1_rowscroll_data;
  35. static unsigned char *actfancr_ram;
  36.  
  37. /******************************************************************************/
  38.  
  39. static READ_HANDLER( actfan_control_0_r )
  40. {
  41.     return readinputport(2); /* VBL */
  42. }
  43.  
  44. static READ_HANDLER( actfan_control_1_r )
  45. {
  46.     switch (offset) {
  47.         case 0: return readinputport(0); /* Player 1 */
  48.         case 1: return readinputport(1); /* Player 2 */
  49.         case 2: return readinputport(3); /* Dip 1 */
  50.         case 3: return readinputport(4); /* Dip 2 */
  51.     }
  52.     return 0xff;
  53. }
  54.  
  55. static int trio_control_select;
  56.  
  57. static WRITE_HANDLER( triothep_control_select_w )
  58. {
  59.     trio_control_select=data;
  60. }
  61.  
  62. static READ_HANDLER( triothep_control_r )
  63. {
  64.     switch (trio_control_select) {
  65.         case 0: return readinputport(0); /* Player 1 */
  66.         case 1: return readinputport(1); /* Player 2 */
  67.         case 2: return readinputport(3); /* Dip 1 */
  68.         case 3: return readinputport(4); /* Dip 2 */
  69.         case 4: return readinputport(2); /* VBL */
  70.     }
  71.  
  72.     return 0xff;
  73. }
  74.  
  75. static WRITE_HANDLER( actfancr_sound_w )
  76. {
  77.     soundlatch_w(0,data & 0xff);
  78.     cpu_cause_interrupt(1,M6502_INT_NMI);
  79. }
  80.  
  81. /******************************************************************************/
  82.  
  83. static struct MemoryReadAddress actfan_readmem[] =
  84. {
  85.     { 0x000000, 0x02ffff, MRA_ROM },
  86.     { 0x062000, 0x063fff, actfancr_pf1_data_r },
  87.     { 0x072000, 0x0727ff, actfancr_pf2_data_r },
  88.     { 0x100000, 0x1007ff, MRA_RAM },
  89.     { 0x130000, 0x130003, actfan_control_1_r },
  90.     { 0x140000, 0x140001, actfan_control_0_r },
  91.     { 0x120000, 0x1205ff, paletteram_r },
  92.     { 0x1f0000, 0x1f3fff, MRA_RAM },
  93.     { -1 }  /* end of table */
  94. };
  95.  
  96. static struct MemoryWriteAddress actfan_writemem[] =
  97. {
  98.     { 0x000000, 0x02ffff, MWA_ROM },
  99.     { 0x060000, 0x06001f, actfancr_pf1_control_w },
  100.     { 0x062000, 0x063fff, actfancr_pf1_data_w, &actfancr_pf1_data },
  101.     { 0x070000, 0x07001f, actfancr_pf2_control_w },
  102.     { 0x072000, 0x0727ff, actfancr_pf2_data_w, &actfancr_pf2_data },
  103.     { 0x100000, 0x1007ff, MWA_RAM, &spriteram, &spriteram_size },
  104.     { 0x110000, 0x110001, buffer_spriteram_w },
  105.     { 0x120000, 0x1205ff, paletteram_xxxxBBBBGGGGRRRR_w, &paletteram },
  106.     { 0x150000, 0x150001, actfancr_sound_w },
  107.     { 0x1f0000, 0x1f3fff, MWA_RAM, &actfancr_ram }, /* Main ram */
  108.     { -1 }  /* end of table */
  109. };
  110.  
  111. static struct MemoryReadAddress triothep_readmem[] =
  112. {
  113.     { 0x000000, 0x03ffff, MRA_ROM },
  114.     { 0x044000, 0x045fff, actfancr_pf2_data_r },
  115.     { 0x064000, 0x0647ff, actfancr_pf1_data_r },
  116.     { 0x120000, 0x1207ff, MRA_RAM },
  117.     { 0x130000, 0x1305ff, paletteram_r },
  118.     { 0x140000, 0x140001, MRA_NOP }, /* Value doesn't matter */
  119.     { 0x1f0000, 0x1f3fff, MRA_RAM },
  120.     { 0x1ff000, 0x1ff001, triothep_control_r },
  121.     { -1 }  /* end of table */
  122. };
  123.  
  124. static struct MemoryWriteAddress triothep_writemem[] =
  125. {
  126.     { 0x000000, 0x03ffff, MWA_ROM },
  127.     { 0x040000, 0x04001f, actfancr_pf2_control_w },
  128.     { 0x044000, 0x045fff, actfancr_pf2_data_w, &actfancr_pf2_data },
  129.     { 0x046400, 0x0467ff, MWA_NOP }, /* Pf2 rowscroll - is it used? */
  130.     { 0x060000, 0x06001f, actfancr_pf1_control_w },
  131.     { 0x064000, 0x0647ff, actfancr_pf1_data_w, &actfancr_pf1_data },
  132.     { 0x066400, 0x0667ff, MWA_RAM, &actfancr_pf1_rowscroll_data },
  133.     { 0x100000, 0x100001, actfancr_sound_w },
  134.     { 0x110000, 0x110001, buffer_spriteram_w },
  135.     { 0x120000, 0x1207ff, MWA_RAM, &spriteram, &spriteram_size },
  136.     { 0x130000, 0x1305ff, paletteram_xxxxBBBBGGGGRRRR_w, &paletteram },
  137.     { 0x1f0000, 0x1f3fff, MWA_RAM, &actfancr_ram }, /* Main ram */
  138.     { 0x1ff000, 0x1ff001, triothep_control_select_w },
  139.     { 0x1ff402, 0x1ff403, H6280_irq_status_w },
  140.     { -1 }  /* end of table */
  141. };
  142.  
  143. /******************************************************************************/
  144.  
  145. static struct MemoryReadAddress dec0_s_readmem[] =
  146. {
  147.     { 0x0000, 0x07ff, MRA_RAM },
  148.     { 0x3000, 0x3000, soundlatch_r },
  149.     { 0x3800, 0x3800, OKIM6295_status_0_r },
  150.     { 0x4000, 0xffff, MRA_ROM },
  151.     { -1 }  /* end of table */
  152. };
  153.  
  154. static struct MemoryWriteAddress dec0_s_writemem[] =
  155. {
  156.     { 0x0000, 0x07ff, MWA_RAM },
  157.     { 0x0800, 0x0800, YM2203_control_port_0_w },
  158.     { 0x0801, 0x0801, YM2203_write_port_0_w },
  159.     { 0x1000, 0x1000, YM3812_control_port_0_w },
  160.     { 0x1001, 0x1001, YM3812_write_port_0_w },
  161.     { 0x3800, 0x3800, OKIM6295_data_0_w },
  162.     { 0x4000, 0xffff, MWA_ROM },
  163.     { -1 }  /* end of table */
  164. };
  165.  
  166. /******************************************************************************/
  167.  
  168. INPUT_PORTS_START( actfancr )
  169.     PORT_START    /* Player 1 controls */
  170.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  171.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  172.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  173.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  174.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  175.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  176.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  177.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
  178.  
  179.     PORT_START    /* Player 2 controls */
  180.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  181.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  182.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  183.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  184.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  185.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  186.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  187.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  188.  
  189.     PORT_START    /* start buttons */
  190.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  191.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  192.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
  193.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  194.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  195.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  196.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  197.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
  198.  
  199.     PORT_START    /* Dip switch bank 1 */
  200.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  201.     PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
  202.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  203.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  204.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  205.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  206.     PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
  207.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  208.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  209.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  210.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
  211.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  212.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  213.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
  214.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  215.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  216.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
  217.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  218.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  219.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  220.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  221.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  222.  
  223.     PORT_START    /* Dip switch bank 2 */
  224.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  225.     PORT_DIPSETTING(    0x03, "3" )
  226.     PORT_DIPSETTING(    0x02, "4" )
  227.     PORT_DIPSETTING(    0x01, "5" )
  228.     PORT_BITX(0,  0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "100", IP_KEY_NONE, IP_JOY_NONE )
  229.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
  230.     PORT_DIPSETTING(    0x04, "Easy" )
  231.     PORT_DIPSETTING(    0x0c, "Normal" )
  232.     PORT_DIPSETTING(    0x08, "Hard" )
  233.     PORT_DIPSETTING(    0x00, "Hardest" )
  234.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  235.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  236.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  237.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Bonus_Life ) )
  238.     PORT_DIPSETTING(    0x20, "800000" )
  239.     PORT_DIPSETTING(    0x00, "None" )
  240.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
  241.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  242.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  243.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  244.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  245.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  246. INPUT_PORTS_END
  247.  
  248. INPUT_PORTS_START( triothep )
  249.     PORT_START    /* Player 1 controls */
  250.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  251.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  252.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  253.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  254.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  255.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  256.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
  257.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
  258.  
  259.     PORT_START    /* Player 2 controls */
  260.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  261.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  262.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  263.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  264.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  265.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  266.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
  267.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  268.  
  269.     PORT_START    /* start buttons */
  270.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  271.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  272.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
  273.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  274.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  275.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  276.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  277.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
  278.  
  279.     PORT_START    /* Dip switch bank 1 */
  280.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  281.     PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
  282.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  283.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  284.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  285.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  286.     PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
  287.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  288.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  289.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  290.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  291.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  292.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  293.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
  294.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  295.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  296.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
  297.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  298.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  299.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  300.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  301.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  302.  
  303.     PORT_START    /* Dip switch bank 2 */
  304.     PORT_START /* Dip switch bank 2 */
  305.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  306.     PORT_DIPSETTING(    0x00, "8" )
  307.     PORT_DIPSETTING(    0x01, "10" )
  308.     PORT_DIPSETTING(    0x03, "12" )
  309.     PORT_DIPSETTING(    0x02, "14" )
  310.     PORT_DIPNAME( 0x0c, 0x0c, "Difficulty (Time)" )
  311.     PORT_DIPSETTING(    0x08, "Easy (130)" )
  312.     PORT_DIPSETTING(    0x0c, "Normal (100)" )
  313.     PORT_DIPSETTING(    0x04, "Hard (70)" )
  314.     PORT_DIPSETTING(    0x00, "Hardest (60)" )
  315.     PORT_DIPNAME( 0x10, 0x10, "Bonus Lives" )
  316.     PORT_DIPSETTING(    0x00, "2" )
  317.     PORT_DIPSETTING(    0x10, "3" )
  318.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  319.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  320.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  321.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  322.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  323.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  324.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  325.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  326.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  327. INPUT_PORTS_END
  328.  
  329. /******************************************************************************/
  330.  
  331. static struct GfxLayout chars =
  332. {
  333.     8,8,    /* 8*8 chars */
  334.     4096,
  335.     4,        /* 4 bits per pixel  */
  336.     { 0x08000*8, 0x18000*8, 0x00000*8, 0x10000*8 },
  337.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  338.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  339.     8*8    /* every char takes 8 consecutive bytes */
  340. };
  341.  
  342. static struct GfxLayout tiles =
  343. {
  344.     16,16,    /* 16*16 sprites */
  345.     2048,
  346.     4,
  347.     { 0, 0x10000*8, 0x20000*8,0x30000*8 },    /* plane offset */
  348.     { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  349.             0, 1, 2, 3, 4, 5, 6, 7 },
  350.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  351.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  352.     32*8    /* every sprite takes 32 consecutive bytes */
  353. };
  354.  
  355. static struct GfxLayout sprites =
  356. {
  357.     16,16,    /* 16*16 sprites */
  358.     2048+1024,
  359.     4,
  360.     { 0, 0x18000*8, 0x30000*8, 0x48000*8 },    /* plane offset */
  361.     { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  362.             0, 1, 2, 3, 4, 5, 6, 7 },
  363.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  364.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  365.     32*8    /* every sprite takes 32 consecutive bytes */
  366. };
  367.  
  368. static struct GfxDecodeInfo actfan_gfxdecodeinfo[] =
  369. {
  370.     { REGION_GFX1, 0, &chars,       0, 16 },
  371.     { REGION_GFX2, 0, &sprites,   512, 16 },
  372.     { REGION_GFX3, 0, &tiles,     256, 16 },
  373.     { -1 } /* end of array */
  374. };
  375.  
  376. static struct GfxDecodeInfo triothep_gfxdecodeinfo[] =
  377. {
  378.     { REGION_GFX1, 0, &chars,       0, 16 },
  379.     { REGION_GFX2, 0, &sprites,   256, 16 },
  380.     { REGION_GFX3, 0, &tiles,     512, 16 },
  381.     { -1 } /* end of array */
  382. };
  383.  
  384. /******************************************************************************/
  385.  
  386. static void sound_irq(int linestate)
  387. {
  388.     cpu_set_irq_line(1,0,linestate); /* IRQ */
  389. }
  390.  
  391. static struct YM2203interface ym2203_interface =
  392. {
  393.     1,
  394.     1500000, /* Should be accurate */
  395.     { YM2203_VOL(50,90) },
  396.     { 0 },
  397.     { 0 },
  398.     { 0 },
  399.     { 0 }
  400. };
  401.  
  402. static struct YM3812interface ym3812_interface =
  403. {
  404.     1,            /* 1 chip */
  405.     3000000,    /* 3.000000 MHz (Should be accurate) */
  406.     { 45 },
  407.     { sound_irq },
  408. };
  409.  
  410. static struct OKIM6295interface okim6295_interface =
  411. {
  412.     1,              /* 1 chip */
  413.     { 7759 },       /* frequency */
  414.     { REGION_SOUND1 },
  415.     { 85 }
  416. };
  417.  
  418. /******************************************************************************/
  419.  
  420. static int actfan_interrupt(void)
  421. {
  422.     return H6280_INT_IRQ1;
  423. }
  424.  
  425. static struct MachineDriver machine_driver_actfancr =
  426. {
  427.     /* basic machine hardware */
  428.     {
  429.         {
  430.             CPU_H6280,
  431.             21477200/3, /* Should be accurate */
  432.             actfan_readmem,actfan_writemem,0,0,
  433.             actfan_interrupt,1 /* VBL */
  434.         },
  435.         {
  436.             CPU_M6502 | CPU_AUDIO_CPU,
  437.             1500000, /* Should be accurate */
  438.             dec0_s_readmem,dec0_s_writemem,0,0,
  439.             ignore_interrupt,0    /* Interrupts from OPL chip */
  440.         }
  441.     },
  442.     60, 529,
  443.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written*/
  444.     0,
  445.  
  446.     /* video hardware */
  447.     32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
  448.  
  449.     actfan_gfxdecodeinfo,
  450.     768, 768,
  451.     0,
  452.  
  453.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_BUFFERS_SPRITERAM | VIDEO_UPDATE_AFTER_VBLANK,
  454.     0,
  455.     actfancr_vh_start,
  456.     0,
  457.     actfancr_vh_screenrefresh,
  458.  
  459.     /* sound hardware */
  460.     0,0,0,0,
  461.     {
  462.         {
  463.             SOUND_YM2203,
  464.             &ym2203_interface
  465.         },
  466.         {
  467.             SOUND_YM3812,
  468.             &ym3812_interface
  469.         },
  470.         {
  471.             SOUND_OKIM6295,
  472.             &okim6295_interface
  473.         }
  474.     }
  475. };
  476.  
  477. static struct MachineDriver machine_driver_triothep =
  478. {
  479.     /* basic machine hardware */
  480.     {
  481.         {
  482.             CPU_H6280,
  483.             21477200/3, /* Should be accurate */
  484.             triothep_readmem,triothep_writemem,0,0,
  485.             actfan_interrupt,1 /* VBL */
  486.         },
  487.         {
  488.             CPU_M6502 | CPU_AUDIO_CPU,
  489.             1500000, /* Should be accurate */
  490.             dec0_s_readmem,dec0_s_writemem,0,0,
  491.             ignore_interrupt,0    /* Interrupts from OPL chip */
  492.         }
  493.     },
  494.     60, 529,
  495.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written*/
  496.     0,
  497.  
  498.     /* video hardware */
  499.     32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
  500.  
  501.     triothep_gfxdecodeinfo,
  502.     768, 768,
  503.     0,
  504.  
  505.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_BUFFERS_SPRITERAM | VIDEO_UPDATE_AFTER_VBLANK,
  506.     0,
  507.     triothep_vh_start,
  508.     0,
  509.     triothep_vh_screenrefresh,
  510.  
  511.     /* sound hardware */
  512.     0,0,0,0,
  513.     {
  514.         {
  515.             SOUND_YM2203,
  516.             &ym2203_interface
  517.         },
  518.         {
  519.             SOUND_YM3812,
  520.             &ym3812_interface
  521.         },
  522.         {
  523.             SOUND_OKIM6295,
  524.             &okim6295_interface
  525.         }
  526.     }
  527. };
  528.  
  529. /******************************************************************************/
  530.  
  531. ROM_START( actfancr )
  532.     ROM_REGION( 0x200000, REGION_CPU1 ) /* Need to allow full RAM allocation for now */
  533.     ROM_LOAD( "fe08-2.bin", 0x00000, 0x10000, 0x0d36fbfa )
  534.     ROM_LOAD( "fe09-2.bin", 0x10000, 0x10000, 0x27ce2bb1 )
  535.     ROM_LOAD( "10",   0x20000, 0x10000, 0xcabad137 )
  536.  
  537.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
  538.     ROM_LOAD( "17-1", 0x08000, 0x8000, 0x289ad106 )
  539.  
  540.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  541.     ROM_LOAD( "15", 0x00000, 0x10000, 0xa1baf21e ) /* Chars */
  542.     ROM_LOAD( "16", 0x10000, 0x10000, 0x22e64730 )
  543.  
  544.     ROM_REGION( 0x60000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  545.     ROM_LOAD( "02", 0x00000, 0x10000, 0xb1db0efc ) /* Sprites */
  546.     ROM_LOAD( "03", 0x10000, 0x08000, 0xf313e04f )
  547.     ROM_LOAD( "06", 0x18000, 0x10000, 0x8cb6dd87 )
  548.     ROM_LOAD( "07", 0x28000, 0x08000, 0xdd345def )
  549.     ROM_LOAD( "00", 0x30000, 0x10000, 0xd50a9550 )
  550.     ROM_LOAD( "01", 0x40000, 0x08000, 0x34935e93 )
  551.     ROM_LOAD( "04", 0x48000, 0x10000, 0xbcf41795 )
  552.     ROM_LOAD( "05", 0x58000, 0x08000, 0xd38b94aa )
  553.  
  554.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  555.     ROM_LOAD( "14", 0x00000, 0x10000, 0xd6457420 ) /* Tiles */
  556.     ROM_LOAD( "12", 0x10000, 0x10000, 0x08787b7a )
  557.     ROM_LOAD( "13", 0x20000, 0x10000, 0xc30c37dc )
  558.     ROM_LOAD( "11", 0x30000, 0x10000, 0x1f006d9f )
  559.  
  560.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* ADPCM sounds */
  561.     ROM_LOAD( "18",   0x00000, 0x10000, 0x5c55b242 )
  562. ROM_END
  563.  
  564. ROM_START( actfanc1 )
  565.     ROM_REGION( 0x200000, REGION_CPU1 ) /* Need to allow full RAM allocation for now */
  566.     ROM_LOAD( "08-1", 0x00000, 0x10000, 0x3bf214a4 )
  567.     ROM_LOAD( "09-1", 0x10000, 0x10000, 0x13ae78d5 )
  568.     ROM_LOAD( "10",   0x20000, 0x10000, 0xcabad137 )
  569.  
  570.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
  571.     ROM_LOAD( "17-1", 0x08000, 0x8000, 0x289ad106 )
  572.  
  573.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  574.     ROM_LOAD( "15", 0x00000, 0x10000, 0xa1baf21e ) /* Chars */
  575.     ROM_LOAD( "16", 0x10000, 0x10000, 0x22e64730 )
  576.  
  577.     ROM_REGION( 0x60000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  578.     ROM_LOAD( "02", 0x00000, 0x10000, 0xb1db0efc ) /* Sprites */
  579.     ROM_LOAD( "03", 0x10000, 0x08000, 0xf313e04f )
  580.     ROM_LOAD( "06", 0x18000, 0x10000, 0x8cb6dd87 )
  581.     ROM_LOAD( "07", 0x28000, 0x08000, 0xdd345def )
  582.     ROM_LOAD( "00", 0x30000, 0x10000, 0xd50a9550 )
  583.     ROM_LOAD( "01", 0x40000, 0x08000, 0x34935e93 )
  584.     ROM_LOAD( "04", 0x48000, 0x10000, 0xbcf41795 )
  585.     ROM_LOAD( "05", 0x58000, 0x08000, 0xd38b94aa )
  586.  
  587.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  588.     ROM_LOAD( "14", 0x00000, 0x10000, 0xd6457420 ) /* Tiles */
  589.     ROM_LOAD( "12", 0x10000, 0x10000, 0x08787b7a )
  590.     ROM_LOAD( "13", 0x20000, 0x10000, 0xc30c37dc )
  591.     ROM_LOAD( "11", 0x30000, 0x10000, 0x1f006d9f )
  592.  
  593.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* ADPCM sounds */
  594.     ROM_LOAD( "18",   0x00000, 0x10000, 0x5c55b242 )
  595. ROM_END
  596.  
  597. ROM_START( actfancj )
  598.     ROM_REGION( 0x200000, REGION_CPU1 ) /* Need to allow full RAM allocation for now */
  599.     ROM_LOAD( "fd08-1.bin", 0x00000, 0x10000, 0x69004b60 )
  600.     ROM_LOAD( "fd09-1.bin", 0x10000, 0x10000, 0xa455ae3e )
  601.     ROM_LOAD( "10",   0x20000, 0x10000, 0xcabad137 )
  602.  
  603.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
  604.     ROM_LOAD( "17-1", 0x08000, 0x8000, 0x289ad106 )
  605.  
  606.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  607.     ROM_LOAD( "15", 0x00000, 0x10000, 0xa1baf21e ) /* Chars */
  608.     ROM_LOAD( "16", 0x10000, 0x10000, 0x22e64730 )
  609.  
  610.     ROM_REGION( 0x60000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  611.     ROM_LOAD( "02", 0x00000, 0x10000, 0xb1db0efc ) /* Sprites */
  612.     ROM_LOAD( "03", 0x10000, 0x08000, 0xf313e04f )
  613.     ROM_LOAD( "06", 0x18000, 0x10000, 0x8cb6dd87 )
  614.     ROM_LOAD( "07", 0x28000, 0x08000, 0xdd345def )
  615.     ROM_LOAD( "00", 0x30000, 0x10000, 0xd50a9550 )
  616.     ROM_LOAD( "01", 0x40000, 0x08000, 0x34935e93 )
  617.     ROM_LOAD( "04", 0x48000, 0x10000, 0xbcf41795 )
  618.     ROM_LOAD( "05", 0x58000, 0x08000, 0xd38b94aa )
  619.  
  620.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  621.     ROM_LOAD( "14", 0x00000, 0x10000, 0xd6457420 ) /* Tiles */
  622.     ROM_LOAD( "12", 0x10000, 0x10000, 0x08787b7a )
  623.     ROM_LOAD( "13", 0x20000, 0x10000, 0xc30c37dc )
  624.     ROM_LOAD( "11", 0x30000, 0x10000, 0x1f006d9f )
  625.  
  626.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* ADPCM sounds */
  627.     ROM_LOAD( "18",   0x00000, 0x10000, 0x5c55b242 )
  628. ROM_END
  629.  
  630. ROM_START( triothep )
  631.     ROM_REGION( 0x200000, REGION_CPU1 ) /* Need to allow full RAM allocation for now */
  632.     ROM_LOAD( "ff16",     0x00000, 0x20000, 0x84d7e1b6 )
  633.     ROM_LOAD( "ff15.bin", 0x20000, 0x10000, 0x6eada47c )
  634.     ROM_LOAD( "ff14.bin", 0x30000, 0x10000, 0x4ba7de4a )
  635.  
  636.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
  637.     ROM_LOAD( "ff18.bin", 0x00000, 0x10000, 0x9de9ee63 )
  638.  
  639.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  640.     ROM_LOAD( "ff12.bin", 0x00000, 0x10000, 0x15fb49f2 ) /* Chars */
  641.     ROM_LOAD( "ff13.bin", 0x10000, 0x10000, 0xe20c9623 )
  642.  
  643.     ROM_REGION( 0x60000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  644.     ROM_LOAD( "ff11.bin", 0x00000, 0x10000, 0x19e885c7 ) /* Sprites */
  645.     ROM_LOAD( "ff10.bin", 0x10000, 0x08000, 0x4b6b477a )
  646.     ROM_LOAD( "ff09.bin", 0x18000, 0x10000, 0x79c6bc0e )
  647.     ROM_LOAD( "ff08.bin", 0x28000, 0x08000, 0x1391e445 )
  648.     ROM_LOAD( "ff03.bin", 0x30000, 0x10000, 0xb36ad42d )
  649.     ROM_LOAD( "ff02.bin", 0x40000, 0x08000, 0x6b9d24ce )
  650.     ROM_LOAD( "ff01.bin", 0x48000, 0x10000, 0x68d80a66 )
  651.     ROM_LOAD( "ff00.bin", 0x58000, 0x08000, 0x41232442 )
  652.  
  653.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  654.     ROM_LOAD( "ff04.bin", 0x00000, 0x10000, 0x7cea3c87 ) /* Tiles */
  655.     ROM_LOAD( "ff06.bin", 0x10000, 0x10000, 0x5e7f3e8f )
  656.     ROM_LOAD( "ff05.bin", 0x20000, 0x10000, 0x8bb13f05 )
  657.     ROM_LOAD( "ff07.bin", 0x30000, 0x10000, 0x0d7affc3 )
  658.  
  659.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* ADPCM sounds */
  660.     ROM_LOAD( "ff17.bin", 0x00000, 0x10000, 0xf0ab0d05 )
  661. ROM_END
  662.  
  663. /******************************************************************************/
  664.  
  665. static READ_HANDLER( cycle_r )
  666. {
  667.     int pc=cpu_get_pc();
  668.     int ret=actfancr_ram[0x26];
  669.  
  670.     if (offset==1) return actfancr_ram[0x27];
  671.  
  672.     if (pc==0xe29a && ret==0) {
  673.         cpu_spinuntil_int();
  674.         return 1;
  675.     }
  676.  
  677.     return ret;
  678. }
  679.  
  680. static READ_HANDLER( cyclej_r )
  681. {
  682.     int pc=cpu_get_pc();
  683.     int ret=actfancr_ram[0x26];
  684.  
  685.     if (offset==1) return actfancr_ram[0x27];
  686.  
  687.     if (pc==0xe2b1 && ret==0) {
  688.         cpu_spinuntil_int();
  689.         return 1;
  690.     }
  691.  
  692.     return ret;
  693. }
  694.  
  695. static void init_actfancr(void)
  696. {
  697.     install_mem_read_handler(0, 0x1f0026, 0x1f0027, cycle_r);
  698. }
  699.  
  700. static void init_actfancj(void)
  701. {
  702.     install_mem_read_handler(0, 0x1f0026, 0x1f0027, cyclej_r);
  703. }
  704.  
  705.  
  706.  
  707. GAME( 1989, actfancr, 0,        actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 2)" )
  708. GAME( 1989, actfanc1, actfancr, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 1)" )
  709. GAME( 1989, actfancj, actfancr, actfancr, actfancr, actfancj, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (Japan revision 1)" )
  710. GAME( 1989, triothep, 0,        triothep, triothep, 0,        ROT0, "Data East Corporation", "Trio The Punch - Never Forget Me... (Japan)" )
  711.